import { defHttp } from '/@/utils/http/axios';
import { IPostRoleUpdateRequest } from '/@/types/system/senior/role/update';
import { IPostRoleDataScopeRaw } from '/@/types/system/senior/role/dataScope';
import { IPostRoleStatusRaw } from '/@/types/system/senior/role/status';
import { IPostRoleAddRequest } from '/@/types/system/senior/role/add';
import { IPostRoleListRequest, IPostRoleListResponse } from '/@/types/system/senior/role/list';
import { IPostRoleExportQuery } from '/@/types/system/senior/role/export';
import { IGetRawRoleDetailsResponse } from '/@/types/system/senior/role/details';

/**
 * 修改角色
 */
export const apiPostRoleUpdate = (params: IPostRoleUpdateRequest) =>
  defHttp.post({ url: `/system/senior/role/update`, params });
/**
 * 修改角色数据权限
 */
export const apiPostRoleDataScopePath = (roleId: string | number, params: IPostRoleDataScopeRaw) =>
  defHttp.post({ url: `/system/senior/role/dataScope/${roleId}`, params });
/**
 * 修改角色状态
 */
export const apiPostRoleStatusPath = (roleId: string | number, params: IPostRoleStatusRaw) =>
  defHttp.post({ url: `/system/senior/role/status/${roleId}`, params });
/**
 * 删除角色
 */
export const apiDeleteRoleDeletePath = (roleId: string | number) =>
  defHttp.delete({ url: `/system/senior/role/delete/${roleId}` });
/**
 * 批量解除角色和用户的关联
 */
export const apiDeleteRoleBulkdeletePath = (userIds: string | number) =>
  defHttp.delete({ url: `/system/senior/role/bulkdelete/${userIds}` });
/**
 * 添加角色
 */
export const apiPostRoleAdd = (params: IPostRoleAddRequest) =>
  defHttp.post({ url: `/system/senior/role/add`, params });
/**
 * 角色列表
 */
export const apiPostRoleList = (params: IPostRoleListRequest) =>
  defHttp.post<IPostRoleListResponse>({ url: `/system/senior/role/list`, params });
/**
 * 角色列表导出
 */
export const apiPostRoleExportQuery = (params: IPostRoleExportQuery) =>
  defHttp.post({ url: `/system/senior/role/export`, params });
/**
 * 角色详情
 */
export const apiGetRoleDetailsPath = (roleId: string | number) =>
  defHttp.get<IGetRawRoleDetailsResponse>({ url: `/system/senior/role/details/${roleId}` });
